package com.example.android_20190529_01;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.RelativeLayout;

public class RelativeLayoutActivity extends AppCompatActivity {
    Button btn_back;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.uc2);
        btn_back=findViewById(R.id.btn_back);
        btn_back.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View view) {
                startActivity(new Intent(RelativeLayoutActivity.this,MainActivity.class));
            }
        });
//        水平居中
        RelativeLayout h=findViewById(R.id.uc02);
        h.setGravity(Gravity.CENTER_HORIZONTAL);
    }
}
